<template>
  <div>
 

   
      <el-form ref="form" :model="form" label-width="90px" >

<el-row>
  <el-col :span="10" >
    <el-form-item label="员工编码：" >
          <el-input v-model="form.code" placeholder="请输入内容"  :model="form" ></el-input>
    </el-form-item>
  </el-col> 
  <el-col :span="10">
  <el-form-item label="用户名：">
          <el-input v-model="form.nickname" placeholder="请输入内容"></el-input>
  </el-form-item>
  </el-col>
</el-row>


<el-row>
  <el-col :span="10" >
    <el-form-item label="角色名称：">
      <el-select v-model="form.roleId" placeholder="请选择活动区域">
        <el-option label="销售组" value="1"></el-option>
        <el-option label="仓管组" value="2"></el-option>
        <el-option label="出库组" value="3"></el-option>
      </el-select>
    </el-form-item>
  </el-col> 
  <el-col :span="10">
  <el-form-item label="员工姓名：">
          <el-input v-model="form.name" placeholder="请输入内容"></el-input>
  </el-form-item>
  </el-col>
</el-row>

<el-row>
  <el-col :span="10" >
    <el-form-item label="所属分店：">
      <el-select v-model="form.subbranchId" placeholder="请选择活动区域">
        <el-option label="望京分店" value="1"></el-option>
        <el-option label="王府井分店" value="2"></el-option>
      </el-select>
    </el-form-item>
  </el-col> 
  <el-col :span="10">
  <el-form-item label="员工电话：">
          <el-input v-model="form.phone" placeholder="请输入内容"></el-input>
  </el-form-item>
  </el-col>
</el-row>

<el-form-item label="身份证号">
    <el-input v-model="form.idcode"></el-input>
  </el-form-item>


  <el-row>
  <el-col :span="10" >
      <el-form-item label="在职状态">
      <el-radio-group v-model="form.status">
        <el-radio label="true">在职</el-radio>
        <el-radio label="false" >离职</el-radio>
      </el-radio-group>
    </el-form-item>
  </el-col> 
  <el-col :span="10" >
    <el-form-item label="所属分组：">
      <el-select v-model="form.groupId" placeholder="请选择活动区域">
        <el-option v-for="item in formlist" :key = "item.id" :label="item.name" :value="item.id" ></el-option>
      </el-select>
    </el-form-item>
  </el-col> 
</el-row>
  

</el-form>
      <div slot="footer" class="dialog-footer">
        <el-button >取 消</el-button>
        <el-button type="primary" @click="addstaff">确 定</el-button>
      </div>
    
  </div>
</template>
<style lang="less" scoped>

  </style>

<script>
import {addPost,getclassPost} from '../../http/api';
export default {
  data() {
    return {
      dialogFormVisible: false,
      form: {
        roleId:'',
        idcode:'',
        name: '',
        nickname:'',
        subbranchId:'',
        phone:'',
        status:'',
        code:'',
        groupId:''
      },
      formLabelWidth: '120px',
      formlist:[]
    }
  },
   methods: {
      onSubmit() {
        console.log('submit!');
       
      },
       getlist(){
       getclassPost()
        .then((res)=>{
          console.log('接口调用成功1',res)
          this.formlist=res.data.value.data
          console.log('接口调用成功1',this.formlist)
        })
        .catch((err)=>{
          console.log('接口调用失败',err)
        })
      },
      addstaff(){
        console.log(this.form)
        addPost(this.form)
              .then((res)=>{
              console.log('添加成功',res)
              // 删除后重新发送获取列表的请求
        })
            .catch((err)=>{
              console.log('添加失败',err)
        })
      }

      },
    created(){
     this.getlist() ,
     console.log('ppp',this.formlist)
  },

}
</script>